# 抽取项目配置
import logging
import redis



class config(object):
    SECRET_KEY = 'ejqihriqwhtrkqhwortjq'
    DEBUG = True
    # 数据哭配置
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information"

    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 设置redis配置
    REDIS_HOST  = '127.0.0.1'
    REDIS_POST  = 6379

    # flask_session配置信息
    SESSION_TYPE = 'redis' # 指定session保存到redis中
    SESSION_USE_SIGNER = True # 让cookie中的session被加密签名处理
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_POST)# 使用redis的实例
    PERMANENT_SESSION_LIFETIME = 86400 * 2# session的有效期，单位是秒
    # 默认日志等级
    LOG_LEVEL = logging.DEBUG
# 开发者配置
class developmentconfig(config):
    DEBUG = True
# 上线配置
class onlineconfig(config):
    DEBUG = False
    # 生产环境日志配置
    LOG_LEVEL = logging.ERROR

class TestingConfig(config):
    DEBUG = True
    TESTING = True

config_dict ={
        'development':developmentconfig,
        'online':onlineconfig,
        'testing': TestingConfig
}